package com.yyf.blogapi.controller;


import com.yyf.blogapi.common.log.LogAnnotation;
import com.yyf.blogapi.service.ITagService;
import com.yyf.blogapi.vo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yyf
 * @since 2021-08-16
 */
@RestController
@RequestMapping("/tags")
public class TagController {

    @Resource
    private ITagService tagService;

    @GetMapping
    public Result tags(){
        return Result.success(tagService.list());
    }

//    @LogAnnotation(module = "标签",operation = "最热")
    @GetMapping("/hot")
    public Result hotTags(){
        int limit =6;
        return Result.success(tagService.hotTags(limit));
    }

    @GetMapping("/detail")
    public Result tagsDetail(){
        return Result.success(tagService.list());
    }

    @GetMapping("/detail/{id}")
    public Result tagDetail(@PathVariable Long id){
        return Result.success(tagService.getById(id));
    }


}
